using UnityEngine;
using System.Collections;

public class Platform_Busy : MonoBehaviour
{
	
	public Vector3 destionationSpot;
	
	private Vector3 originSpot;
	public float speed;
	private bool Switch = false;
	
	// Use this for initialization
	void Start ()
	{
		originSpot = transform.position;
	}
	
	// Update is called once per frame
	void FixedUpdate ()
	{
		if (transform.position == destionationSpot)
			Switch = true;
		
		if (transform.position == originSpot)
			Switch = false;
		
		if (Switch)
			transform.position = Vector3.MoveTowards(transform.position, originSpot, speed);
		else
			transform.position = Vector3.MoveTowards(transform.position, destionationSpot, speed);
	}
}
